const _ = require('lodash');

const DEVEL = 'development';
const DEVEL_SHORT = 'dev';
const PROD = 'production';
const PROD_SHORT = 'prod';
const TEST = 'test';

function filterMode(mode) {
  switch (_.toLower(mode)) {
    case 'test' :
    case 'uat' :
    case 't' :
      return TEST;
    case 'development' :
    case 'devel' :
    case 'dev' :
    case 'd' :
      return DEVEL;
    case 'production' :
    case 'prod' :
    case 'p':
    default :
      return PROD;
  }
}

function getModeShortName(mode) {
  switch (filterMode(mode)) {
    case PROD :
      return PROD_SHORT;
    case DEVEL :
      return DEVEL_SHORT;
    case TEST :
    default :
      return TEST;
  }
}

module.exports = {
  filterMode,
  getModeShortName,
};